package com.base.service;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.base.exceptions.DaoException;

public interface GenericService <T> extends Serializable {
	//--- ABM
	public void save(T entity) throws DaoException;
	public void merge(T entity) throws DaoException;
	public void update(T entity) throws DaoException;
	public void delete(T entity) throws DaoException;
	public void deleteById(Serializable id) throws DaoException;
	public void deleteAll() throws DaoException;
	public void deleteQuery(String condition) ;
	
	//--- Consulta
	public long count() throws DaoException;
	public T get(Serializable id) throws DaoException;
	public List<T> getAll() throws DaoException;
	public T getByCodigo(Object codigo) throws DaoException;
	public T getUnique(String campoUnique, Object valorUnique) throws DaoException;

	//--- Con paginacion
	public List<T> getAll(int firstRow, int maxResult) throws DaoException;

	//--- Lazy
	public List<T> getByConsulta(Map<String, Object> filtros, Integer firstResult, Integer maxResults, 
									String sortField, String sortOrder, Object count);
	
	public List<T> getByQuery(Map<String, Object> filtros);
}
